package com.zplus.managers.petservices.entities;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Pet extends EntityBase
{
    // fields

    private String petname;
    private int speciesId;
    private String species;
    private String gender;
    private Date birthday;
    private Integer state;

    public int getSpeciesId()
    {
        return speciesId;
    }

    public void setSpeciesId(int speciesId)
    {
        this.speciesId = speciesId;
    }

    public int getId()
    {
        return super.getId();
    }

    public void setId(int id)
    {
        super.setId(id);
    }

    public String getPetname()
    {
        return petname;
    }

    public void setPetname(String petname)
    {
        this.petname = petname;
    }

    public String getSpecies()
    {
        return species;
    }

    public void setSpecies(String species)
    {
        this.species = species;
    }

    public String getGender()
    {
        return gender;
    }

    public void setGender(String gender)
    {
        this.gender = gender;
    }

    public Date getBirthday()
    {
        return birthday;
    }

    public void setBirthday(Date birthday)
    {
        this.birthday = birthday;
    }
    public void setBirthday(String birthday)
    {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            this.birthday = new Date(format.parse(birthday).getTime());
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
    public Integer getState()
    {
        return state;
    }

    public void setState(Integer state)
    {
        this.state = state;
    }

    public Pet(){}

    public Pet(Integer id, String petname, String species, String gender, Date birthday, Integer state)
    {
        super.setId(id);
        this.petname = petname;
        this.species = species;
        this.gender = gender;
        this.birthday = birthday;
        this.state = state;
    }
}
